package com.IoLiu;

import java.io.File;
import java.io.IOException;

public class FileDemo01 {
    public static void main(String[] args) throws IOException {
        //不能创建新目录的同时创建新可执行文件则发生异常
        //创建目录与创建文件分开创建例子:file3与file4.
//        File file1=new File("D:\\下载\\file\\java1.txt");
//        System.out.println(file1.getPath());
//        System.out.println(file1);
//        boolean b1=file1.createNewFile();
//        System.out.println(b1);
        File file1=new File("D:\\下载\\file\\java1.txt");
        boolean b5=file1.delete();
        System.out.println(b5);
        System.out.println("- - - - - - - - - - - - - - - - - - - - ");
        File file2=new File("D:\\下载\\file\\file2","file2xia");
        System.out.println(file2.getPath());
        System.out.println(file2);
        boolean b2=file2.mkdirs();
        System.out.println(b2);
        File file3=new File("D:\\下载\\file\\file3\\xia");
        System.out.println(file3.getPath());

        boolean b3=file3.mkdirs();
        System.out.println(file3);
        System.out.println(b3);
        File file4=new File(file3,"java3.txt");
        System.out.println(file3.list().toString());
        System.out.println(file4.getPath());
        boolean b4=file4.createNewFile();
        System.out.println(file4);
        System.out.println(b4);
        File file5=new File(file3,"java5.txt");
        file5.createNewFile();
        File file6=new File(file3,"java6.txt");
        file6.createNewFile();
        File file7=new File(file3,"java7.txt");
        file7.createNewFile();
        File file8=new File(file3,"java8.txt");
        file8.createNewFile();
        File file9=new File(file3,"java9.txt");
        file9.createNewFile();
        for (int i = 0; i < file3.list().length; i++) {
            System.out.println(file3.list()[i]);
        }
    }
}
